#include <math.h>
#include <iostream>
#include <conio.h>

double f(double x)
{
	return sqrt(0.6*x + 1.7) / (2.1*x + sqrt(0.7*x*x + 1.0));
}

double fi(double a, double b, int i, int n)
{
	return a + ((b - a) * i) / (2*n);
}

int main(int argc, char argv[])
{
	int n = 50;
	double a = 1.2;
	double b = 2.0;

	double q=0, w=0, e=0, r=0;
	double result;

	q = f(fi(a, b, 0, n));

	for(int i=1; i<2*n; i=i+2)
	{
		w += f(fi(a, b, i, n));
	}

	for(int i=2; i<2*n; i=i+2)
	{
		e += f(fi(a, b, i, n));
	}

	r = f(fi(a, b, n*2, n));

	result = ((b-a) / (6*n)) * (q + 4*w + 2*e + r);

	std::cout << "Resultat: " << result;

	getch();

	return 0;
}